package com.imooc.project.util;
/**
 * Description:
 * <p>
 * ClassName: ResultUtil
 * date: 2021/8/31 15:13
 *
 * @author Yin.Liu
 * @version 1.0
 * @since JDK 1.8
 */

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.api.R;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName ResultUtil
 * @Description 统一样式的返回值
 * @Author Yin.Liu8
 * @Date 2021/8/31 15:13
 * @Version 1.0
 */
public class ResultUtil {

    /**
     * 构建分页查询的返回结果
     *
     * @param page
     * @return
     */
    public static R<Map<String, Object>> buildPageR(IPage<?> page) {
        HashMap<String, Object> data = new HashMap<>();
        data.put("count", page.getTotal());
        data.put("records", page.getRecords());
        return R.ok(data);
    }
}
